<?php
class Goods_map_profit_model extends CI_Model
{
    private $table = 'goods_map_profit';
    
    public function findByParams($params=array())
    {
        if (!empty($params['goods_id'])) {
            $this->db->where('goods_id', $params['goods_id']);
        }
        if (!empty($params['goods_ids'])) {
            $this->db->where_in('goods_id', $params['goods_ids']);
        }
        if (!empty($params['status'])) { //profit - bargaining
            $this->db->where('status', $params['status']);
        }
        if (!empty($params['bit_trade'])) {
            $this->db->where('bit_trade & '.$params['bit_trade'].'=', $params['bit_trade']);
        }
        if (!empty($params['orderby'])) {
            $this->db->order_by($params['orderby']);
        }
        return $this->db->get($this->table);
    }
    
}